home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
randomgn.zip
/
RANDOMGN.DOC
< prev
next >
Wrap
Text File
|
1991-06-28
|
2KB
|
32 lines
RANDOMGN is a set a programs to generate and make available random
numbers. It consists of a TSR (RANTSR) which measures the time interval
between keyboard interrupts (in units of approximately 4 microseconds)
mod 256, and a sample program (APPRAND) to access the list of random bytes
and build a file of random bytes.
The TSR maintains a circular buffer of random numbers. After the TSR is
loaded, it hooks to the multiplex interrupt. To obtain n random numbers,
set al=n ; ah=aeh ; dx = 726eh ; es:di=buffer address for the numbers
INT 2F
Returns with al=ffh (success) or al=00 (not all n values returned)
dx = number of values returned
all other registers unchanged
The TSR stores one random byte every time the keyboard interrupt (INT9)
is activated. The byte is bits 9-2 of the current Timer 0 value.
Note that n=0 can be used to determine whether or not the TSR has been
loaded
The source of the TSR is in RANTSR.ASM, and the TSR com file is RANTSR.COM.
APPRAND illustrates how to interface to the TSR. The program accesses
the random byte list, and appends the bytes to the file RANDOM.LOG. The
turbo pascal source is in APPRAND.PAS, and the executable is in APPRAND.EXE.
If anyone does a statistical analysis of the quality of this random
number generator, I would be very interested.
Written by Joseph R Ahlgren, BBS 703-241-7980, CompuServe 70461,2340
This program is freeware. It may be used without restriction, provided
the original source is acknowledged.
91/06/28